uniform sampler2D tex;

varying vec2 texcoord;
varying vec3 normal, lightpos, pos;

void main()
{
   vec4 lightDir = normalize( vec4( lightpos, 1 )  - vec4( pos, 1 ) );
   float intensity = dot( vec4( normal, 0 ), lightDir );
   gl_FragColor = texture2D(tex, texcoord) * intensity;
}
